<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>统计字符最多统计</title>

    <script>
        var a = new String('awdawdawgawvdsvcjabdQNadwa');
        var o = new Array();
        for (var i = 0; i < a.length; i++) {
            var char = a.charAt(i);
            a.indexOf(char);
            if (o[char]) {
                o[char]++;
            } else {
                o[char] = 1;
            }
        }
        console.log(o);
        var max = 0;
        var chr = '';
        for (k in o) {
            if (o[k] > max) {
                max = o[k];
                chr = k;
            }
        }
        console.log(max);
        console.log(chr);
    </script>




</head>

<body>



</body>

</html>